package com.ying.service;

import com.ying.entity.MachineEntity;
import com.ying.repository.MachineDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.time.ZonedDateTime;

@Service
public class MachineService {

    @Autowired
    private MachineDao machineDao;

    public Page<MachineEntity> findAll(Pageable pageable) {
        Pageable t = new PageRequest(pageable.getPageNumber() - 1,pageable.getPageSize());
        return machineDao.findAll(t);
    }

    public void save(MachineEntity machineEntity) {
        machineDao.save(machineEntity);
    }
}
